import { functionCommon, lsCommon, requestCommon } from "@whzhuke/common"

export default {
  login: async (params: any) => {
    const e = await requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/login`,
      params
    })

    const { accessToken } = e.data!
    lsCommon.setItem("token", accessToken)
    return e.data
  },
  logout: () => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/sys/logout`
    })
  }
}
